import axios from 'axios'
import apiUrls from 'common/api-urls'

export function getCoursePage(data) {
  return axios.get(apiUrls.getCoursePage, {
    params: data
  })
}

export function getCourseInfos(data) {
  return axios.get(`${apiUrls.getCourseInfos}/${data.id}`, {
    params: data
  })
}

export function getExercise(data) {
  return axios.get(`${apiUrls.getExercise}/${data.courseId}`, {
    params: data
  })
}

export function getCourseGroup(data) {
  return axios.get(`${apiUrls.getCourseGroup}/${data.courseId}`, {
    params: data
  })
}

export function bindGroup(data) {
  return axios.post(apiUrls.bindGroup, {
    ...data
  })
}

export function getStudyCourseList(data) {
  return axios.post(apiUrls.getStudyCourseList, {
    ...data
  })
}

export function studySwitchLesson(data) {
  return axios.post(apiUrls.studySwitchLesson, {
    ...data
  })
}

export function commitExercise(data) {
  return axios.post(apiUrls.commitExercise, {
    ...data
  })
}

export function getExerciseReport(data) {
  return axios.get(`${apiUrls.getExerciseReport}/${data.exerciseId}`, {
    params: data
  })
}

export function getExerciseReportState(data) {
  return axios.get(`${apiUrls.getExerciseReportState}/${data.exerciseId}`, {
    params: data
  })
}
